<!--  -->
<template>
  <div>
    <div
      class="listDataItem"
      v-for="(item, index) in listData"
      :key="'Warfare' + index"
    >
      <div class="listDataContentBox">
        {{ index + 1 }}
        、{{ item.title }}
      </div>
      <div class="operation">
        <span
          class="operation_btn operation_btn_delete"
          @click="handleDelete(item)"
        ></span>
        <span
          class="operation_btn operation_btn_edit"
          @click="handleEdit(item)"
        ></span>
        <span
          v-show="showUpLoad"
          class="operation_btn operation_btn_up_load"
          @click="handleUpShelves(item)"
        ></span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    listData: {
      type: Array,
      default: () => {
        return [];
      },
    },
    showUpLoad: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    /**
     * @description 列表按钮点击事件
     * @param { }
     * @return { }
     */
    handleDelete(item) {
      this.$emit("handleDelete", { item: item, com: 0 });
    },
    handleEdit(item) {
      this.$emit("handleEdit", { item: item, com: 0 });
    },
    handleUpShelves(item) {
      this.$emit("handleUpShelves", { item: item, com: 0 });
    },
  },
};
</script>
<style  scoped>
.listDataItem {
  height: 56px;
  margin-top: 4px;
  background-color: #f7fafb;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  padding-right: 24px;
}

.listDataContentBox {
  padding-left: 56px;
  padding-right: 56px;
  flex: 1;
  width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.operation {
  flex-shrink: 0;
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: nowrap;
  justify-content: start;
  align-items: center;
  width: 120px;
}
.operation_btn {
  width: 20px;
  height: 20px;
  margin-left: 20px;
  background-size: cover;
  background-repeat: no-repeat;
}
.operation_btn_up_load {
  background-image: url("../../assets/image/up_load.png");
}
.operation_btn_edit {
  background-image: url("../../assets/image/edit.png");
}
.operation_btn_delete {
  background-image: url("../../assets/image/delete.png");
}
</style>